<template>
	<view>
		<uni-list>
			<uni-swipe-action ref="swipeAction">
				<uni-swipe-action-item v-for="(item, index) in taskForm" :right-options="options1" :key="item.id" @click="swipeClick($event, item)">
					<uni-list-item :title="item.taskName" :note="item.teamName" showArrow clickable :rightText="item.routeName" @click="ToDetail(item)" />
				</uni-swipe-action-item>
			</uni-swipe-action>
		</uni-list>
	</view>
</template>

<script>
import { getInspectionOrderList } from '@/api/system/user.js';
export default {
	data() {
		return {
			taskForm: [],
			options1: [
				{
					text: '执行',
					style: {
						backgroundColor: '#00f1f5'
					}
				}
			]
		};
	},
	onLoad() {
		this.GetInspectionOrderList();
	},
	methods: {
		GetInspectionOrderList() {
			getInspectionOrderList().then((res) => {
				this.taskForm = res.rows;
				console.log('getInspectionOrderList', res);
			});
		},
		//左滑触发
		swipeClick(e, item) {
			let { content } = e;
			if (content.text === '执行') {
				uni.navigateTo({
					url: `/pages/work/Inspection/detail?id=${item.id}`
				});
				// this.popValue = item.content;
				// uni.navigateTo({
				// 	url: `/pages/work/SubOrder?id=${item.id}`
				// });
				// this.$tab.navigateTo('/pages/work/SubOrder');
				// console.log('item', item);
			}
		}
	}
};
</script>

<style lang="scss">
.example-body {
	padding: 10px;
	padding-top: 0;
}
</style>
